BuildTarget=libthreadpool.so
currentpath=$(shell pwd)
compiler=g++
#set so path, include path,lib path
srcpath=$(currentpath)
incpath=$(currentpath)/../include
libpath=$(currentpath)/../lib

$(warnning $(currentpath))
srcfiles=$(wildcard $(srcpath)/*.cc)
objfiles=$(patsubst %.cc,%.o,$(srcfiles))
$(warnning $(srcfiles))

sharedlibs=-lpthread

compflags=-c -g -fPIC -fsanitize=address

sharedflags=-fPIC --shared -Wl,-rpath=./

$(warnning $(objfiles))

all:$(BuildTarget)

clean:
	rm -f *.so *.o

$(BuildTarget):$(objfiles)
	$(compiler) $(sharedflags) -L $(libpath) $(objfiles) -o $(BuildTarget) $(sharedlibs)

%.o:%.cc
	$(compiler) $(compflags) -I $(incpath) $^ -o $@
